package 
{

	import com.srcpoint.common.text.TextManager;
	import com.srcpoint.common.tips.SimpleTip;
	import com.srcpoint.common.tips.TipManager;
	
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLLoaderDataFormat;
	import flash.net.URLRequest;
	import flash.system.ApplicationDomain;
	import flash.system.LoaderContext;
	import flash.text.TextFormat;
	import flash.utils.ByteArray;
	
	[SWF(width='798', height='648')]
	public class Test_tip extends Sprite
	{
		
		public function Test_tip()
		{
//			var sp:Sprite = new Sprite();
//			sp.graphics.beginFill(0xcccccc);
//			sp.graphics.drawRect(0,0,300,100);
//			sp.graphics.endFill();
//			sp.x = 200;
//			sp.y=200;
//			addChild(sp);
//			SmartTip.setRoot(stage);
////			SmartTip.tipDefaultStyle['backgroundCornerRadius'] = 6;
//			SmartTip.InitDefaultCss();
//			sp.addEventListener(MouseEvent.CLICK,function click(evt:MouseEvent):void{
//				var stip:SmartTip = SmartTip.createTip(sp,"<span class='red'>我边捡闪电狗欢乐谷</span>\r<p class='blue'>我边捡闪电狗欢乐谷</p>",int(Math.random()*4));
//				stip.setAutoClose(2000);
//				stip.setStyle("arrowIndentPercent",50);
//				stip.showCloseButton();
//				stip.refresh();
//			});
			var loader:URLLoader = new URLLoader();
			loader.addEventListener(Event.COMPLETE,onloadFont);
//			loader.load(new URLRequest("lists__3c9254eb.ddd"),new LoaderContext(false,ApplicationDomain.currentDomain));
			loader.load(new URLRequest("config_tip.xml"));

		}
		private var tformat:TextFormat;
		private function onloadFont(evt:Event):void{
			var loader:URLLoader = (evt.currentTarget as URLLoader);
			var data:XML = XML(loader.data);
			var tm:TipManager = TipManager.getInstance();
			tm.initTipItemStyle(data.setting.tipstyle[0]);
			var txtm:TextManager = TextManager.getInstance();
			txtm.initTextStyle(data.setting.txtstyle[0]);
			tm.parent = stage;
			var tip:SimpleTip = new SimpleTip();
			tip.x = 200;
			tip.y = 200;
			graphics.beginFill(0xff0000);
			graphics.moveTo(200,200);
			graphics.drawCircle(200,200,10);
			graphics.endFill();
			tip.show(XML("<t><tip tipType='test' textType='color'>abcaaaaaaaa</tip><tip tipType='color' textType='test'>abcabaaagba</tip><tip tipType='test' textType='color'>abcabba</tip></t>"),2);
			addChild(tip);
		}
	}
}